<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>class类继承-2</title>
</head>

<body>
  <script>
    class Phone {
      constructor(brand, price) {
        this.brand = brand;
        this.price = price;
      }

      call() {
        console.log("我可以打电话")
      }
    }

    class smartMobile extends Phone {
      constructor(brand, price, color, size) {
        super(brand, price);    // Phone.call(this, brand, price);
        this.color = color;
        this.size = size;
        // this.brand = "华为"
      }

      phone() {
        console.log("我可以拍照");
      }

      play() {
        console.log("我可以玩游戏");
      }

      // 重写父类的方法
      call() {
        // super();      // 子类不允许调用父类的方法 不能super   报错：Uncaught SyntaxError: 'super' keyword unexpected here
        console.log("我可以打视频电话")
      }
    }

    let xiaomi = new smartMobile("小米", 2499, "银白色", "5.7inch");
    console.log(xiaomi);
    xiaomi.call();
    xiaomi.phone();
    xiaomi.play();
  </script>
</body>

</html>